Exercises Sheet 3

(W) denotes workshop exercises; (A) denotes homework questions; (E) additional exercises for completion in your own time.

Workshop Exercises

  1. 1.

    (W) You are consulting with a health professional with regard to designing a study. What values need to be specified in advance in order to perform a sample size calculation to compare

    1. (a)

      two group means?

    2. (b)

      two group proportions?

  2. 2.

    (W) The z-test to compare a single group mean is based upon the assumption that the standard deviation σ is known. What distribution does the test statistic Z follow under

    1. (a)

      the null hypothesis?

    2. (b)

      the alternate hypothesis?

  3. 3.

    (W) The z-test to compare two group means is based upon the assumption that the standard deviation σ is common to both groups and also that it is known. What distribution does the test statistic Z follow under

    1. (a)

      the null hypothesis?

    2. (b)

      the alternate hypothesis?

  4. 4.

    (W) Using the definition of power derive the sample size formula for the two-group z-test [see course notes page 90 for the formula that you should be able to derive by defining power and expressing in terms of the test statistic conditional]. You should denote the total sample size by n and the proportion of patients belonging to group 1 by r.

  5. 5.

    (W) Two experimental groups are to be given different diets and their growth measured. On the basis of your derivation in 2, (this should correspond to the formula for n given in the notes on page 90 if you have not done this as yet) compute the sample size required to achieve 80% power to detect a difference of 0.5cm in a population with a standard deviation of 2cm. You should use a two-sided Z-test at the 1% level.

  6. 6.

    (W) Without doing any calculations what would happen to the required sample size if you increase:

    1. (a)

      the estimate of the standard deviation?

    2. (b)

      the size of the difference to be detected (i.e. the clinically relevant difference: δ*)?

  7. 7.

    (W) You can use R to compute the sample size required using the power.t.test(.) function. Note that this function computes the exact sample size (i.e using t-quantiles). Run R and enter the code below.

    > power.t.test(delta=0.5, sd=2, sig.level = 0.01, power = 0.8)
    

    Note the arguments are, respectively, the size of difference to be detected, the standard deviation, the significance level and the required power. Compare your result to question (5).

  8. 8.

    (W) The cumulative non-central t-distribution (CDF) is available in R. You simply need to add the value of non-centrality parameter (ncp) to the pt(.) function. You can draw up a plot of the non-central t-distribution with ncp = 3 and 25 degrees of freedom using the following code.

    > curve(pt(x, 25, ncp=3), from = 0, to = 6)
    

    You can add the upper-value (tcrit) for the acceptance region for a two-sided test using:

    > abline(v=qt(0.975, 25)
    

    Can you see how you might estimate the power from this graphic? Hint: What does the function pt(.) actually evaluate? How does this relate to the power?

  9. 9.

    (W) You can also use the power.t.test(.) function in R to compute the power for a given sample size. Suppose you recruited 400 patients (200 patients per group) the power could be calculated as follows:

    > power.t.test(n=200, delta=0.5, sd=2, sig.level = 0.01)
    
  10. 10.

    (W) You can use the power.prop.test(.) function in R to calculate the sample size needed to detect a given difference in two proportions p1-p2 with a given power. The estimated proportions, the significance level and the power need to be specified in this setting. Why is an estimate of the variance (sd) not needed here? Typically one can estimate the p1 from historical data and p2 is then derived based upon the difference you would wish to detect.

    Suppose the 5 year survival probability on standard therapy is known to be 10% and we wish to have 80% power to detect a difference of of 5% with a type I error rate of 5%. We could use R to compute the sample size as follows:

    > power.prop.test(p1=0.1, p2=0.15, sig.level=0.05, power = 0.8)
    

    Suppose we are willing to increase that clinically relevant difference to be 10%. How does this effect the sample size?

  11. 11.

    (W) A knee surgery is planned. Suppose we expect that the success rate on standard therapy is 20% and we wish to detect a difference of 15% with 90% power and with a type I error rate of 5%. How many patients need to be recruited?

    Homework Exercises

  12. 12.

    (H) Suppose a double-blind randomised placebo-controlled trial is being planned that aims to investigate the efficacy of Enalapril in normotensive diabetes patients. It is unclear whether the mean arterial pressure is reduced or raised by Enalapril. The patients are treated over a period of 6 months. In a previous trial, a standard deviation of σ9 mm Hg was observed. From a medical point of view, a difference in blood pressure of about 10 mm Hg compared with placebo is seen to be the smallest clinically relevant difference.

    1. (a)

      Perform an approximate sample size calculation for this trial. Consider a balanced design, a significance level α=0.05 (two-sided), and a desired power of 1-β=0.80.

    2. (b)

      Using R: How much does the exact sample size (using t-distribution) differ from the Normal approximation?

    3. (c)

      Perform a sensitivity analysis by varying σ. You may want to define a range of values for σ and plot the required sample size n as a function.

    Additional Exercises

  13. 13.

    (E) Consider the following situation: XiN(μ,σ2), i=1,,n, identically and independently distributed with known σ2.

    1. (a)

      Give an expression for a 1-α% confidence interval for μ.

    2. (b)

      Using this derive a sample size formula, for n, that ensures that the total length of this confidence interval is smaller or equal to δ.

  14. 14.

    (E) Researchers want to compare two treatments for glaucoma. Patients with glaucoma will be recruited and randomly assigned to either treatment A or B. The main outcome measure is intraocular pressure, and there will be equal numbers of patients in each group.

    1. (a)

      If the researchers want a 90% chance of rejecting the null hypothesis that H0:μA=μB when there is a true difference in treatment group expectations of 0.8, what sample size do they need? Assume α=0.05 and σA2=σB2=10.

    2. (b)

      Given this sample size, sketch the power function of this test. To do this you should fix n and vary δ*

    3. (c)

      Without doing any calculations, how would the power function would change if the sample size was smaller. Similar or larger.

    4. (d)

      Vary n and show this on your plot.

  15. 15.

    (E) When conducting two-sided tests there is also a risk of falling into the rejection region on the opposite side of the true value. The power calculations we have considered do not take this into account. What do you think are the consequences of this and why? What is the maximum value this could be?